<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <h1>我是app父组件</h1>
    <!-- 1. 父组件给子组件传值 通过属性传递 -->
    <test-com v-bind:address="info" age="18" data-address="jn"></test-com>
  </div>
  <script src="./vue.js"></script>
  <script>
    Vue.component('test-com', {
      props: ['address', 'age', 'dataAddress'],  // 2. 子组件 通过 props 接受父组件传递的 属性名
      template: `<div>
        <h2>我是test子组件---{{address}}---{{age}}--{{dataAddress}}</h2>
      </div>`
    })
    new Vue({  // 根 root 组件
      data: {
        info: '北京'
      },
      el: '#app'
    })
  </script>
</body>
</html>